package com.zhiyou100.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class MyController implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse resp) throws Exception {
		//实例化一个空的modelandview对象，模型视图对象
		ModelAndView mav = new ModelAndView();
		//把数据添加到对象中
		mav.addObject("message", "哈哈，成功了");
		
		//添加视图
		mav.setViewName("/WEB-INF/jsp/index.jsp");
		return mav;
	}
}
